package com.argticling.controller;

import com.argticling.model.Article;
import com.argticling.model.User;
import com.argticling.service.ArticleService;
import com.argticling.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA. User: santiracca Date: Nov 1, 2010 Time: 8:13:55 AM
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping("/writer")
public class WriterController {

	@Autowired
	UserService userService;
    @Autowired
    ArticleService articleService;

	@RequestMapping(value = "", method = RequestMethod.GET)
	public ModelAndView writeArticle2(HttpServletRequest request) {
		return writeArticle(request);
	}

	@RequestMapping(value = "/", method = RequestMethod.GET)
	public ModelAndView writeArticle(HttpServletRequest request) {
		
		ModelAndView mav = new ModelAndView("/writer/writeArticle");
		return mav;

	}

	/*@RequestMapping(value = "/modify/{articleId}", method = RequestMethod.GET)
	public ModelAndView modifyArticle(HttpServletRequest request, 
			@PathVariable String articleId ) {

        Article art = articleService.getArticle(articleId);
		ModelAndView mav = new ModelAndView("/writer/writeArticle");
		mav.addObject("article", art);
		return mav;

	}
	@RequestMapping(value = "/preview/{articleId}", method = RequestMethod.GET)
	public ModelAndView modify(HttpServletRequest request, @PathVariable String articleId) {

		
		Article art = articleService.getArticle(articleId);
		ModelAndView mav = new ModelAndView("/writer/prewiewArticle");
        mav.addObject("article", art);
		return mav;
	}*/

}
